// 游戏状态类
public class GameState {
    private int level;      // 当前层数
    private int durability; // 当前耐久
    private int score;      // 当前分数
    private int bestScore;  // 最高分
    private boolean isOver; // 判断游戏是否结束

    // GameState构造方法
    public GameState(int best) {
        bestScore = best;
        reset();
    }

    // 重置游戏
    public void reset() {
        level = 1;
        durability = 100;
        score = 0;
        isOver = false;
    }

    // getter和setter
    public int getLevel() {
        return level;
    }

    public void setLevel(int l) {
        level = l;
    }

    public int getDurability() {
        return durability;
    }

    public void setDurability(int d) {
        durability = d;
    }

    public int getScore() {
        return score;
    }

    public void addScore(int s) {
        score += s;
        if(score > bestScore) {
            bestScore = score;
        }
    }

    public int getBestScore() {
        return bestScore;
    }

    public boolean isOver() {
        return isOver;
    }

    public void setOver(boolean o) {
        isOver = o;
    }
}